<template>
    <div class="Viewopint-box">
        <div class="opint-box">
            <van-nav-bar
                title="写点评"
                left-text="返回"
                right-text="发布"
                left-arrow
                @click-left="onClickLeft"
                @click-right="onClickRight"
                ></van-nav-bar>
            

        </div>
        <div class="opint-main">
            <textarea v-model="text" name="" id="text-box" placeholder="友善的评论是交流的起点..."></textarea>
        </div>
    </div>
</template>

<script>
    import { Toast } from 'vant';
    import { EventBus } from "../event-bus";



    export default {
        name:'Viewpoint',
        data(){
            return{
            text:'',
            }
        },

        components:{
            Toast,
        },

        beforeDestroy(){
             EventBus.$emit("fromMsg", this.text);
             this.text='';
        },

        methods:{
        onClickLeft() {
            this.$router.go(-1);
        },
        onClickRight() {
           
           
            
            Toast('发布成功');
            this.$router.go(-1);
           
        },

        },
       
        

    }
</script>

<style lang="less" scoped>

    .opint-box{
        height: 46px;
        margin-bottom: 15px;
    }


    .opint-main{
        width: 100%;
       
        display: flex;
        justify-content: center;
    }

    textarea{
        
        width: 90%;
       border: none;
       outline: none;
       height: calc(95vh - 46px);
        line-height: 20px;
        resize: none;
       font-size: 16px;
        letter-spacing:1px;
        
    }
    
</style>